import pandas as pd

df = pd.read_csv(open('C:\\Users\\27498\\Desktop\\hanhongwei.csv', encoding='utf-8'))
new_df = df[df['Province'].notnull()]
str_data = ''
for i in range(new_df.shape[0]):
    str_data = str_data + new_df.iloc[i, 4]

import re

str_data = re.sub('span', '', str_data, re.S)
str_data = re.sub('class', '', str_data, re.S)
str_data = re.sub('emoji', '', str_data, re.S)

import jieba.analyse

tage = jieba.analyse.extract_tags(str_data, topK=50, withWeight=True)
label = []
attr = []
for item in tage:
    label.append(item[0])
    attr.append(int(item[1] * 1000))

from pyecharts import WordCloud

wordcloud = WordCloud(width=800, height=800)
wordcloud.add("", label[3:], attr[3:], word_size_range=[20, 100])
wordcloud.render("participle.html")
